#!/usr/bin/env bash
#ps -p 6176 -o etime

pid=$1
timeout=180

#if [ $# == 2 ]
#then
#    pid=$2
#fi

cmd="ps -p $pid -o etimes="

diff=`eval $cmd`

if [[ $diff -gt $timeout ]]
then
    echo "timeout $diff s"
    pkill -9 $pid
else
    echo "...$diff s"
fi
